import { defineConfig } from 'vitepress'
import {
  containerPreview,
  componentPreview,
} from '@vitepress-demo-preview/plugin';

import { resolve } from 'path';
const alias = {
  '@pgh-big-screen/vue-ui': resolve(__dirname, '../../../packages/vue3-ui/src'),
  '@pgh-big-screen/examples': resolve(__dirname, '../../../examples/src')
};

// https://vitepress.dev/reference/site-config
export default defineConfig({
  lang: 'zh-CN',
  title: "大屏组件库开放文档",
  description: "使用 VitePress + Vue3 构建的静态站点",
  base: '/pghUI/',

  // 配置Markdown插件
  markdown: {
    theme: {
      light: 'vitesse-light',
      dark: 'vitesse-dark',
    },
    lineNumbers: true,
    config(md) {
      md.use(componentPreview, { clientOnly: true, alias });
      md.use(containerPreview, { clientOnly: true, alias });
    },
  },
  vite: {
    resolve: {
      alias,
    },
  },
  themeConfig: {
    // siteTitle: 'My Custom Title',
    logo: '/logo.svg',
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: '首页', link: '/' },
      { text: '指南', link: '/guide/info' },
      { text: '组件', link: '/components/' },
      { text: '示例', items:[
        { text: '基础示例', link: '/example/base' },
        { text: '高级示例', link: '/example/advanced' },
        { text: '图表示例', link: '/example/charts' },
        { text: '交互示例', link: '/example/interactions' },
        { text: '主题定制', link: '/example/theming' }
      ] },
      { text: '官网', link: 'https://www.chaokong.com.cn/', target: '_blank', rel: '超控数科' }
    ],
    sidebar: {
      '/guide/': [
        {
          text: '开发指南',
          items: [
            { text: '简介', link: '/guide/info' },
            { text: '快速开始', link: '/guide/getting-started' },
          ]
        }
      ],
      '/components/': [
        {
          text: '基础组件',
          collapsed: false,
          items: [
            { text: 'Button 按钮', link: '/components/basic/button/index' },
            { text: 'TechButton 科技按钮', link: '/components/basic/techButton/index' },
            { text: 'Card 卡片', link: '/components/basic/card/index' },
            { text: 'Input 输入框', link: '/components/basic/input/index' }
          ]
        }
      ]
    },
    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
    ],
    footer: {
      message: 'Released under the MIT License.',
      copyright: 'Copyright ©2025-present Kevin'
    }
  }
})
